package com.hellpro.lolbox.base;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by zhonghang on 16/8/31.
 */

public abstract class BaseFragment extends Fragment {

    private Context context;
    private Unbinder mBind;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.context = context;
    }


    public Context getFActivity() {
        return context;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        //去除掉窗口的标题

        View view = inflater.inflate(getLayoutId(), container, false);
        mBind = ButterKnife.bind(this, view);//黄油刀的绑定

        initView();
        return view;
    }


    public abstract void initView();

    public abstract int getLayoutId();

    @Override
    public void onResume() {
        super.onResume();
        //第三方数
    }

    @Override
    public void onPause() {
        super.onPause();
        //第三方数
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mBind != null) {
            mBind.unbind();//黄油刀的解绑
        }

    }

}
